package com.gx.controller.page;

import com.gx.domain.SysFileDetail;
import com.gx.service.api.FastdfsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/file")
public class FileUiPageController {

    @Autowired
    private FastdfsService fastdfsService;

    @GetMapping("/gallerys.htm")
    public ModelAndView galleryList() {
        ModelAndView mv = new ModelAndView();

        List<SysFileDetail> sysFileDetails = fastdfsService.queryList();

        mv.setViewName("/system/gallery/gallery");
        mv.addObject("gallery",sysFileDetails);

        return mv;
    }

    @GetMapping("/fileList.htm")
    public String fileList() {
        return "/system/file/list";
    }

    @GetMapping("/addFile.htm")
    public String addFile() {
        return "/system/file/add";
    }

    @GetMapping("/testFile.htm")
    public String testFile() {
        return "/system/file/test";
    }
}
